package rcache

import (
	"C_ProblemWorkOrder/model"
)

var r = model.RedisConn{}
var m = model.MysqlOrm{}

var (
	err error
)

func CacheSetProblems(Questions ,Answer string) error {
	for i:=0; i<3; i++{
		err = r.SetProblems(Questions,Answer)
		if err != nil {
			continue
		}
		return nil
	}
	return nil
}

func CacheGetProblems(key string) (string,error) {
	res,err := r.GetProblems(key)
	if err != nil {
		return "",err
	}

	if res == nil {
		m1,err := m.GetProblems(key)
	}
	tmp := string(res.(byte))
	return tmp,nil
}

